package com.hy.demo.learn.开发支持类库.定时操作;

import java.util.Timer;
import java.util.TimerTask;

/**
 * <p>
 *
 * </p>
 *
 * @author cjl
 * @version 1.0
 * @since 2020-08-28 15:09
 */

class MyTask extends TimerTask{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"定时调度---->"+System.currentTimeMillis());
    }
}
public class TaskDemo {
    public static void main(String[] args) {

        Timer timer=new Timer();
      //  timer.schedule(new MyTask(),0);
        timer.scheduleAtFixedRate(new MyTask(),1000,1000);
    }


}
